package com.zjfgz.lib_kt_com.user

import android.os.Bundle
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.widget.Toast
import androidx.navigation.fragment.findNavController
import com.zjfgz.lib_kt_com.R
import com.zjfgz.lib_kt_com.`fun`.toast
import com.zjfgz.lib_kt_com.base.BaseActivity
import kotlinx.android.synthetic.main.activity_yinsi.*
import kotlinx.android.synthetic.main.fragment_feed_back.*

open class FeedBackActivity : BaseActivity(){

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_feedback)
        toolbar.setNavigationOnClickListener {
            finish()
        }
        toolbar.setNavigationIcon(R.drawable.ic_arrow_back)
        toolbar.title = "意见反馈"
        tv_commit.setOnClickListener {
            val content: String = et_content.text.toString()
            if (TextUtils.isEmpty(content)) {
                Toast.makeText(this,"请输入反馈意见",Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
            Toast.makeText(this,"已提交",Toast.LENGTH_SHORT).show()
            finish()
        }
        et_content.addTextChangedListener(object : TextWatcher {
            override fun afterTextChanged(s: Editable?) {

            }

            override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

            }

            override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
                tv_tip.text = s.toString().length.toString() + "/200"
            }
        })
    }
}